package com.gitee.pagekit;

import com.gitee.pagekit.utils.StringUtil;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author wxy
 * @version 1.0
 * @date 2024/5/11 18:15
 */
@ConfigurationProperties(prefix = "page-kit")
public class PageProperties {

    private Integer pageNum;

    private Integer pageSize;

    private String pagNumAliases;

    private String pagSizeAliases;

    public Integer getPageNum() {
        if(this.pageNum == null){
            return 1;
        }
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        if(this.pageSize == null){
            return 10;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getPagNumAliases() {
        if(StringUtil.isEmpty(this.pagNumAliases)){
            return "pageNum";
        }
        return pagNumAliases;
    }

    public void setPagNumAliases(String pagNumAliases) {
        this.pagNumAliases = pagNumAliases;
    }

    public String getPagSizeAliases() {
        if(StringUtil.isEmpty(this.pagSizeAliases)){
            return "pageSize";
        }
        return pagSizeAliases;
    }

    public void setPagSizeAliases(String pagSizeAliases) {
        this.pagSizeAliases = pagSizeAliases;
    }
}
